package com.vanke.vms.management.action;

import java.util.List;

import com.vanke.vms.common.action.BaseAction;
import com.vanke.vms.common.domain.AddInfo;
import com.vanke.vms.common.domain.Info;
import com.vanke.vms.common.domain.Pair;
import com.vanke.vms.common.domain.User;
import com.vanke.vms.management.service.ModifyInfoService;

public class ModifyInfoAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7329321537293241937L;

	private ModifyInfoService modifyInfoService;

	private String modifyInfoId;
	
	private Info info;

	private List<AddInfo> addiInfoList;

	private int role;

	public String loadColumn() {
		User curUser = (User)session.get("user");
		if(curUser == null)
			return LOGIN;
		if(curUser.getGrade() == 2)
			role = 2;
		else if(curUser.getGrade() == 1)
			role = 1;
		else if(curUser.getGrade() == 0)
			role = 0;
		
		info = modifyInfoService.loadInfo(modifyInfoId);
		addiInfoList = modifyInfoService.loadAddiInfoList(modifyInfoId);
		return SUCCESS;
	}
	
	public String modifyInfo(){
		return modifyInfoService.modifyInfo(modifyInfoId, info, addiInfoList);
	}

	// //////////////////////////////////////////////////////下边是set和get
	
	public int getRole() {
		return role;
	}

	public void setRole(int role) {
		this.role = role;
	}
	
	public Info getInfo() {
		return info;
	}

	public void setInfo(Info info) {
		this.info = info;
	}

	public List<AddInfo> getAddiInfoList() {
		return addiInfoList;
	}

	public void setAddiInfoList(List<AddInfo> addiInfoList) {
		this.addiInfoList = addiInfoList;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String getModifyInfoId() {
		return modifyInfoId;
	}

	public void setModifyInfoId(String modifyInfoId) {
		this.modifyInfoId = modifyInfoId;
	}

	public ModifyInfoService getModifyInfoService() {
		return modifyInfoService;
	}

	public void setModifyInfoService(ModifyInfoService modifyInfoService) {
		this.modifyInfoService = modifyInfoService;
	}
}
